<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/classes/DBHelper.class.jsp"%>
<%@ include file="/classes/CommonHelper.class.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String guid = getParameter(request,"guid");
	if(nullOrEmpty(guid)){
		out.print("<script>alert(\"参数错误\");</script>");
		return;
	}
	
	int currentPage = 1;
	if(!nullOrEmpty(getParameter(request,"currentPage"))){
		currentPage = Integer.parseInt(getParameter(request,"currentPage"));
	}
	
	String sql = "select t1.*,t2.name dept_name from app_myzj_info t1 left join cms_department t2 on t1.dept_code = t2.code_name where t1.guid = ?";
	Map<String,Object> info = getObject(sql,new Object[]{guid});
	
	pageContext.setAttribute("info",info);
	
	
	String sqlHf = "select t1.*,t2.name user_name from APP_MYZJ_HF_INFO t1 left join cms_user t2 on t1.user_id = t2.user_id where myzj_id = ? order by pub_time desc";
	List<Map<String,Object>> list = queryForListPage(sqlHf,new Object[]{guid},currentPage,15); 	
	
	int total = queryForPageCount(sqlHf,new Object[]{guid});
	
	Map<String,Integer> pageMap = new HashMap<String,Integer>();
	pageMap.put("currentPage",currentPage);
	pageMap.put("total",total);
	request.setAttribute("page",pageMap);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>民意征集-后台审核</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></meta>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<link href="../js/tablecloth/tablecloth.css" rel="stylesheet" type="text/css" media="screen" />
<style type="text/css">
*{padding:0; margin:0 auto;} /* IE8*/
*+html *{padding:0; margin:0;}
table, th, td{
	font-size: 12px;
	padding:5px; margin:5px; 
}

a{color:red; text-decoration:none;}
</style>
</head>
<body>
	<h3>${info.title }</h3>
	<br/><br/><br/>
	<form name="myform" action="myzj_verify.jsp?guid=<%=guid %>&r=<%=new Date().getTime() %>" method="post">
	<table width="100%" >
			<tr>
				<th>提交人</th>
				<th>内容</th>
				<th width="120">提交时间</th>
				<th width="80">当前状态</th>
				<th width="80">审核人</th>
				<th width="80">操作</th>
			</tr>
			<c:forEach items="<%=list %>" var="hf">
			<tr>
				<td>${hf.nick_name }</td>
				<td title="${hf.content }">${hf.content }</td>
				<td>
					<c:if test="${null!=hf.pub_time }">
					<f:formatDate value="${hf.pub_time }" pattern="yyyy-MM-dd"/>
					</c:if>
				</td>
				<td>
				<%--状态（0：未审核，1：通过，2：不通过） --%>
					<c:if test="${hf.status==0 }">
					未审核
					</c:if>
					<c:if test="${hf.status==1 }">
					通过
					</c:if>
					<c:if test="${hf.status==2 }">
					不通过
					</c:if>
				</td>
				<td>
				    ${hf.user_name }
				</td>
				<td>
					[<a href="myzj_verify_do.jsp?guid=${hf.guid }&status=1&myzj_id=${info.guid}&r=<%=new Date().getTime()%>">通过</a>]
					[<a href="myzj_verify_do.jsp?guid=${hf.guid }&status=2&myzj_id=${info.guid}&r=<%=new Date().getTime()%>">不通过</a>]
				</td>
			</tr>
			</c:forEach>
			<tr>
				<td colspan="6">
				<jsp:include page="/common/page.jsp" >
		    		<jsp:param value="${page.currentPage }" name="currentPage"/>
					<jsp:param value="${page.total }" name="totalRecord"/>
					<jsp:param value="15" name="pageSize"/>
					<jsp:param value="myform" name="formName"/>
		    	</jsp:include>
		    	</td>
		    </tr>
		    <tr>
		    	<td colspan="6">
		    	<input type="button" value="返回" width="80px" onclick="window.location.href='myzj_list.jsp?r=<%=new Date().getTime() %>'" height="40px"/>
		    	</td>
		    </tr>
		</table>
	</form>
</body>
</html>